home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / controls / geticon1.frm < prev    next >
Text File  |  1993-05-16  |  4KB  |  161 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Subdirectory Icon Viewer"
  4.    ClientHeight    =   4020
  5.    ClientLeft      =   1425
  6.    ClientTop       =   1515
  7.    ClientWidth     =   7365
  8.    Height          =   4425
  9.    Left            =   1365
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4020
  12.    ScaleWidth      =   7365
  13.    Top             =   1170
  14.    Width           =   7485
  15.    Begin CommandButton Command3 
  16.       Caption         =   "End"
  17.       Height          =   615
  18.       Left            =   2760
  19.       TabIndex        =   2
  20.       Top             =   3240
  21.       Width           =   1695
  22.    End
  23.    Begin CommandButton Command2 
  24.       Caption         =   "Show Icons"
  25.       Enabled         =   0   'False
  26.       Height          =   615
  27.       Left            =   4800
  28.       TabIndex        =   1
  29.       Top             =   3240
  30.       Width           =   2295
  31.    End
  32.    Begin CommandButton Command1 
  33.       Caption         =   "Choose a subdirectory"
  34.       Height          =   615
  35.       Left            =   240
  36.       TabIndex        =   0
  37.       Top             =   3240
  38.       Width           =   2175
  39.    End
  40.    Begin Label Label1 
  41.       Alignment       =   2  'Center
  42.       Caption         =   "Click on an Icon to See Its Path"
  43.       Height          =   255
  44.       Left            =   1920
  45.       TabIndex        =   3
  46.       Top             =   2880
  47.       Visible         =   0   'False
  48.       Width           =   3135
  49.    End
  50.    Begin Image Image1 
  51.       Height          =   495
  52.       Index           =   0
  53.       Left            =   0
  54.       Top             =   0
  55.       Width           =   495
  56.    End
  57. End
  58. Option Explicit
  59.  
  60. Dim pic_count As Integer
  61. Const DEFAULT = 0        ' 0 - Default
  62. Const ARROW = 1          ' 1 - Arrow
  63. Const CROSSHAIR = 2      ' 2 - Cross
  64. Const IBEAM = 3          ' 3 - I-Beam
  65. Const ICON_POINTER = 4   ' 4 - Icon
  66. Const SIZE_POINTER = 5   ' 5 - Size
  67. Const SIZE_NE_SW = 6     ' 6 - Size NE SW
  68. Const SIZE_N_S = 7       ' 7 - Size N S
  69. Const SIZE_NW_SE = 8     ' 8 - Size NW SE
  70. Const SIZE_W_E = 9       ' 9 - Size W E
  71. Const UP_ARROW = 10      ' 10 - Up Arrow
  72. Const HOURGLASS = 11     ' 11 - Hourglass
  73. Const NO_DROP = 12       ' 12 - No drop
  74.  
  75. Sub clear_icons ()
  76.     Dim i As Integer
  77.     'Set the image control array back to just 1 control
  78.     For i = 1 To pic_count
  79.     Unload image1(i)
  80.     Next i
  81.     image1(0).Visible = False
  82.     pic_count = 0
  83. End Sub
  84.  
  85. Sub Command1_Click ()
  86.     clear_icons
  87.     form2.Show
  88. End Sub
  89.  
  90. Sub Command2_Click ()
  91.     Dim PictureName As String
  92.     Dim i As Integer, rc As Integer
  93.     Dim mytop As Integer, myleft As Integer
  94.     Dim widthdelta As Integer, heightdelta As Integer
  95.     
  96.     widthdelta = 600: heightdelta = 500
  97.     mytop = 100: myleft = -widthdelta + 100
  98.     
  99.     clear_icons
  100.  
  101.     'Next, pull the files into the image controls.
  102.     screen.MousePointer = HOURGLASS
  103.     pic_count = form2.File1.ListCount - 1
  104.  
  105.     For i = 0 To pic_count
  106.     If i <> 0 Then Load image1(i)
  107.     image1(i).Left = myleft
  108.     If image1(i).Left > Form1.ScaleWidth - 2 * widthdelta Then
  109.         myleft = 100
  110.         mytop = mytop + heightdelta
  111.     Else
  112.         myleft = myleft + widthdelta
  113.     End If
  114.     image1(i).Move myleft, mytop
  115.     PictureName = form2.Dir1.Path
  116.     If Right$(PictureName, 1) <> "\" Then
  117.         PictureName = PictureName + "\"
  118.     End If
  119.     form2.File1.ListIndex = i
  120.     PictureName = PictureName + form2.File1
  121.     image1(i).Picture = LoadPicture(PictureName)
  122.     Next i
  123.     
  124.     'Now that they're all in memory, show 'em.
  125.     For i = 0 To pic_count
  126.     image1(i).Visible = True
  127.     Next i
  128.     
  129.     screen.MousePointer = DEFAULT
  130.     command2.Enabled = False
  131.     label1.Visible = True
  132. End Sub
  133.  
  134. Sub Command3_Click ()
  135.     End
  136. End Sub
  137.  
  138. Sub Form_Load ()
  139.     Load form2
  140.     pic_count = 0
  141. End Sub
  142.  
  143. Sub Image1_Click (index As Integer)
  144.     Dim PictureName As String
  145.     
  146.     PictureName = form2.Dir1.Path
  147.     If Right$(PictureName, 1) <> "\" Then
  148.     PictureName = PictureName + "\"
  149.     End If
  150.     
  151.     form2.File1.ListIndex = index
  152.     PictureName = PictureName + form2.File1
  153.     
  154.     MsgBox UCase$(PictureName), 0, "The name of that file is"
  155. End Sub
  156.  
  157. Sub Picture1_DragDrop (source As Control, X As Single, Y As Single)
  158.     source.Visible = False
  159. End Sub
  160.  
  161.